package com.bsoft.productor;

import com.bsoft.message.Demo06Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Demo06Producer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void  synSend(Integer  id){
        //创建消息
        Demo06Message message = new Demo06Message();
        message.setId(id);
        //同步发送消息
        rabbitTemplate.convertAndSend(Demo06Message.EXCHANGE,Demo06Message.ROUTING_KEY,message);
    }

}
